Dear Team, Module name : 0P_05.DAT I have a Attribute call xyz text based. This is having module name in braces in it but without .DAT in it> For illustration, the Attribute content looks like: Tetr ..... [0P_05].....text I want to check this attribute contains the module name and record the object absolute number. Requesting you guys to provide the generalised the solutions or suggestions so that I Can re-use for other modules too...
Kiran_Kamble - Tue Sep 11 13:00:03 EDT 2018 |
Re: ModuleNameMatching in Attribute and extract the Object number something like this?
// a regular expression that finds a literal dot
Regexp findDot= regexp2 "\\."
string modname = name mod // assuming that the module is stored in variable "mod"
if (findDot modname) {
// found a literal dot. from "0P_05.DAT" extract the part before the dot, i.e. "0P_05"
string ModWithoutExtension = modname [0:(start 0)-1]
for o in mod do {
string objtext = o."MyAttr""" // assuming that the text shall be found in attribute "MyAttr"
// regular expression to find braces and the module name
Regexp findModReference = regexp2 "\\[" ModWithoutExtension "]"
if (findModReference objtext) {
print "found a reference to the module in " o."Absolute Number""\n"
}
} else {
print "illegal module name"
}
|
Re: ModuleNameMatching in Attribute and extract the Object number Mike.Scharnow - Tue Sep 11 13:47:53 EDT 2018 something like this?
// a regular expression that finds a literal dot
Regexp findDot= regexp2 "\\."
string modname = name mod // assuming that the module is stored in variable "mod"
if (findDot modname) {
// found a literal dot. from "0P_05.DAT" extract the part before the dot, i.e. "0P_05"
string ModWithoutExtension = modname [0:(start 0)-1]
for o in mod do {
string objtext = o."MyAttr""" // assuming that the text shall be found in attribute "MyAttr"
// regular expression to find braces and the module name
Regexp findModReference = regexp2 "\\[" ModWithoutExtension "]"
if (findModReference objtext) {
print "found a reference to the module in " o."Absolute Number""\n"
}
} else {
print "illegal module name"
}
Hi, Thanks a Lot, I have used this logic to traverse through all the modules... great help Cheers....Mike!!! |